package com.sgl.myview.view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.LinearLayout;

/**
 * Created by sunqiyong on 2016/12/2.
 */

public class MyLinearLayout extends LinearLayout {
    private int mDownY, mUpY;

    public MyLinearLayout(Context context) {
        super(context);
    }

    public MyLinearLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }


    @Override
    public boolean onTouchEvent(MotionEvent event) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                mDownY = (int) event.getY();
                break;

            case MotionEvent.ACTION_UP:
                mUpY = (int) event.getY();
                if (mUpY > mDownY) {// 右滑
                    Log.e("qwer","11111111111111111");
                }else {
                    Log.e("qwer","22222222222222222");
                }
                break;
        }
        return true;
    }
}
